<?php

namespace App\Validate;

use App\Validate\BaseValidate;

/**
 * 图书到家阅读书单管理
 */
class BookHomeReadingListValidate extends BaseValidate
{
    //验证规则
    protected $rule = [
        'id' => 'bail|required|integer',
        'shop_id' => 'bail|required|integer',
        'name' => 'bail|required',
        'intro' => 'bail|required',
        'type' => 'required|integer|in:1,2', //订单类型
    ];
    //自定义验证信息
    protected $message = [
        'id.required' => 'ID不能为空',
        'id.integer' => 'ID格式不正确',
        'shop_id.required' => '书店ID不能为空',
        'shop_id.integer' => '书店ID格式不正确',
        'name.required' => '名称不能为空',
        'intro.required' => '内容不能为空',
        'type.required' => '类型不能为空',
        'type.in' => '类型规则不正确',

    ];

    //自定义场景
    protected $scene = [
        'lib_add' => ['name', 'intro'], //添加
        'lib_change' => ['id', 'name', 'intro'], //修改
        'shop_add' => ['shop_id', 'name', 'intro'], //添加
        'shop_change' => ['id', 'shop_id', 'name', 'intro'], //修改
        'detail' => ['id'], //详情
        'del' => ['id'], //删除

    ];
}
